import {
  PERSONAL_TASK_INIT,
  PERSONAL_TASK_CHANGE
} from '../actions';
import { updateState } from '../utils';

const INITIAL_STATE = {
  data: [],
  state:{
    confirmFailMsg:'',
    showConfirmSuccess: false,
    showConfirmfail: false
  },
  error: {}
};

export default function (state = INITIAL_STATE, action = {}) {
  switch (action.type) {
    case PERSONAL_TASK_INIT:
      {
        return { ...state, ...INITIAL_STATE }
      }
    case PERSONAL_TASK_CHANGE:
      {
        return updateState(state, action.data);
      }
    default:
      return state;
  }
}